import {Node} from '@antv/x6'
import {Graph} from '@antv/x6'

Graph.registerNode(
  'AndGateP',
  {
    inherit: 'path', // 继承于 name 节点
    width: 40,
    height: 40,
    label: '与',
    path:'M0 26.8173C22.1132 9.56296 35.2132 8.22215 60 26.8173L60 73.0538L0 73.0538L0 26.8173Z ',
    attrs: {
      body: {
        stroke: '#6DC1E3',
        strokeWidth: 1,
        fill: '#6DC1E3',
        rx: 6,
        ry: 6,
      },
    },
    ports: {
      groups: {
        top: {
          position: {
            name:'top',
            args:{
              // dx:10,
              // dy:0,
              // angle:10,
              // x:40,
              // y:30
            }
          },
          attrs: {
            circle: {
              magnet: true,
              stroke: '#8f8f8f',
              r: 5,
              visibility:'hidden',
            },
          },
        },
        bottom1: {
          position: {
            name:'bottom',
            args:{
              dx:-14,
              // dy:-10
            }
          },
          attrs: {
            circle: {
              magnet: true,
              stroke: '#8f8f8f',
              r: 5,
              visibility:'hidden',
            },
          },
        },
        bottom2: {
          position: 'bottom',
          attrs: {
            circle: {
              magnet: true,
              stroke: '#8f8f8f',
              r: 5,
              visibility:'hidden',
            },
          },
        },
        bottom3: {
          position: {
            name:'bottom',
            args:{
              dx:14
            }
          },
          attrs: {
            circle: {
              magnet: true,
              stroke: '#8f8f8f',
              r: 5,
              visibility:'hidden',
            },
          },
        },
      },
    },
  },
  true,
)




/**数据库节点 */
export const AndGateP: Node.Metadata = {
  shape: 'AndGateP',   //对应上面注册的 name
  attrs: {
    // body: {
    //   refPoints: '10,0 40,0 30,20 0,20'
    // },

  },
  ports: {
    items: [
      {
        id: 'port_1',
        group: 'top',
      },
      {
        id: 'port_2',
        group: 'bottom1',
      },
      {
        id: 'port_3',
        group: 'bottom2',
      },
      {
        id: 'port_4',
        group: 'bottom3',
      },
    ],
  },
}
